<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改测评因子信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-factor-edit" th:object="${scaleFactor}">
            <input name="factorId" th:field="*{factorId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">因子名称：</label>
                <div class="col-sm-8">
                    <input name="factorName" th:field="*{factorName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">因子所属量表id：</label>
                <div class="col-sm-8">
                    <select name="scaleId" class="form-control m-b"
                            th:with="scale=${@scaleService.selectScaleList(null)}">
                        <option value="">请选择</option>
                        <option th:each="s : ${scale}" th:text="${s.scaleTitle}"
                                th:value="${s.scaleId}" th:field="*{scaleId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">分数范围及结果解释：</label>
                <div class="col-sm-8">
                    <textarea name="factorResult" class="form-control" style="height: 180px">[[*{factorResult}]]</textarea>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">量表的总分计分公式：</label>
                <div class="col-sm-8">
                    <select name="formulaId" class="form-control m-b" th:with="scaleFormula=${@scaleFormulaService.selectScaleFormulaList(null)}">
                        <option value="">所有</option>
                        <option th:each="s : ${scaleFormula}" th:text="${s.formulaName}"
                                th:value="${s.formulaId}" th:field="*{formulaId}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/factor";
        $("#form-factor-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-factor-edit').serialize());
            }
        }
    </script>
</body>
</html>